 
import java.util.Scanner;
import java.util.Collection;
import java.util.ArrayList;
//import java.util.TreeSet;
 
 
public class CollectionExample {
 
	public static void main(String[] args) {
		Collection coll = new ArrayList();
		//Collection coll = new TreeSet();
 
		Scanner input = new Scanner(System.in);
 
		boolean done = false;
		while (!done) {
			System.out.print("command: ");
 
			String verb = input.next();
 
			if (verb.equals("add")) {
				String str = input.next();
				coll.add(str);
			}
			else if (verb.equals("contains")) {
				String str = input.next();
				if (coll.contains(str)) {
					System.out.println(str + " is in the collection");
				}
				else {
					System.out.println(str + " is not in the collection");
				}
			}
			else if (verb.equals("remove")) {
				String str = input.next();
				coll.remove(str);
			}
			else if (verb.equals("print")) {
				System.out.println(coll.toString());
			}
			else if (verb.equals("exit")) {
				done = true;
			}
 
			input.nextLine();
		}
	}
 
}
 